package at.ac.tuwien.prog.parser;

import java.io.File;
import java.io.IOException;

import at.ac.tuwien.prog.command.ICommand;
import at.ac.tuwien.prog.entity.Register;
import at.ac.tuwien.prog.entity.Software;

/**
 * transforms files/string/bits into its object counterparts.
 * 
 * @author christoph.pickl@student.tuwien.ac.at
 */
public interface IParser {
	
	/**
	 * utility method, reading file content and invokes same method but with string argument.
	 * @param input existing file containing assembler code
	 * @return proper initialized software instance
	 * @throws IOException if file is not existing or not readable
	 */
	Software parseFile(File input) throws IOException;
	
	/**
	 * interpreting a program by its string representation.
	 * 
	 * @param input assembler code
	 * @return proper initialized software instance
	 */
	Software parseText(String input);
	
	/**
	 * transforms a command in its bit representation to its object representation.
	 * 
	 * @param registerValue containing bits for the command
	 * @return proper initialized command instance
	 */
	ICommand parseBits(Register registerValue);
	
}
